package com.example.service.aboutStudent.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.vo.response.StudentMoreInfoDTO;
import com.example.mapper.aboutStudent.StudentMoreInfoMapper;
import com.example.pojo.aboutStudent.StudentMoreInfo;
import com.example.service.aboutStudent.StudentMoreInfoService;
import com.example.vo.Result;
import org.springframework.stereotype.Service;

@Service
public class StudentMoreInfoServiceImpl extends ServiceImpl<StudentMoreInfoMapper, StudentMoreInfo> implements StudentMoreInfoService {


    @Override
    public Result getStudentMoreInfoByMoreId(Integer moreId) {
        LambdaQueryWrapper<StudentMoreInfo> studentMoreInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
        studentMoreInfoLambdaQueryWrapper.eq(StudentMoreInfo::getId, moreId).eq(StudentMoreInfo::getIsDelete, false);

        StudentMoreInfo studentMoreInfo = super.getOne(studentMoreInfoLambdaQueryWrapper);

        return Result.success(BeanUtil.copyProperties(studentMoreInfo, StudentMoreInfoDTO.class));
    }
}
